package com.hand.wfive.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import com.hand.wfive.R
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import kotlinx.android.synthetic.main.progress_dialog.*

/**
 * 仅用于弹窗样式的activity(QMUI由于上下文问题无法正常弹出)
 */
class ProgressLoadingDialog(
    var mContext: Context,
    private var tipsContent: String = "请稍后...",
    private var isCancelable: Boolean? = false,
) : Dialog(mContext, R.style.LoadingDialog) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.progress_dialog)
        //按空白处不能取消动画
        window?.attributes?.width = QMUIDisplayHelper.getScreenWidth(mContext)
        setCanceledOnTouchOutside(isCancelable == true)
        setCancelable(isCancelable == true)

        tvTipsContent.text = tipsContent
    }

}